<!--
 * @Descripttion: 一级参数
 * @Author: xiao li
 * @Date: 2020-07-06 12:17:07
 * @LastEditors: xiao li
 * @LastEditTime: 2021-04-28 15:40:35
-->
<template>
  <div class="lb-goods-list">
    <top-nav />
    <div class="page-main">
      <el-row class="page-top-operate">
        <el-button plain size="medium" @click="$router.push('/malls/parimary')">设置参数</el-button>
        <el-button type="primary" @click="showTemplate=!showTemplate" size="medium" icon="el-icon-circle-plus">添加模板</el-button>
      </el-row>

      <lb-page
        :page="searchForm.page"
        :pageSize="searchForm.limit"
        :total="total"
        :batch="false"
        @handleSizeChange="handleSizeChange"
        @handleCurrentChange="handleCurrentChange"
      ></lb-page>
    </div>
    <!-- 添加模板 -->
    <lb-templte :showTemplate="showTemplate"></lb-templte>
  </div>
</template>

<script>
export default {
  data () {
    return {
      showTemplate: false,
      loading: false,
      searchForm: {
        page: 1,
        limit: 10
      },
      tableData: [],
      total: 0,
      multipleSelection: []
    }
  },
  created () {
    this.getDataList()
  },
  activated () {
  },
  methods: {
    upperAndDelGoods () {

    },
    getDataList () {
      this.$api.getGoodsParameterTemplateList().then(res => {
        if (res.code === 200) {
          this.tableData = res.data
          alert(1)
          this.total = res.data.total
        }
      })
    },
    handleSelectionChange (val) {
      this.multipleSelection = val
    },
    handleSizeChange (val) {
      this.searchForm.limit = val
      this.handleCurrentChange(1)
    },
    handleCurrentChange (val) {
      this.searchForm.page = val
      this.getDataList()
    }
  }
}
</script>

<style lang="scss" scoped>
.lb-goods-list {
  width: 100%;
  .page-main {
    width: 100%;
    padding: 20px;

    .el-table {
      img {
        width: 80px;
        height: 80px;
      }
    }
  }
}
</style>
